package org.glorylight.hacks.social.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang3.ArrayUtils;

@Entity
@Table(name = "tipsDetail")
public class TipsDetail implements Serializable{

	private static final long serialVersionUID = -6966462241914291153L;
	
	@Id
	private String id;
	
	@Lob
	@Column(name = "content", nullable = false)
	private Byte[] content;
	
	@OneToOne
	private Tips tips;
	
	public TipsDetail() {
		
	}

	public TipsDetail(String id, Byte[] content) {
		this.id = id;
		this.content = content;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Byte[] getContent() {
		return content;
	}
	
	@Transient
	public String getContentDetail() {
		return new String(ArrayUtils.toPrimitive(content));
	}

	public void setContent(Byte[] content) {
		this.content = content;
	}

	public Tips getTips() {
		return tips;
	}

	public void setTips(Tips tips) {
		this.tips = tips;
	}
}
